// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
.color-picker {
  overflow: hidden;
  display: flex;
  height: 250px;
  flex-direction: row;
  font-size: 13px;

  &-left {
    width: 140px;
    border-right: 1px solid $gray-210;
    // @include shadow-ambient;

    height: 100%;
    display: flex;
    flex-direction: column;
  }

  &-palettes-list {
    flex: 1 1;

    ul {
      list-style-type: none;
      margin: 0;
      padding: 0;

      .label {
        line-height: 20px;
        padding: 0px 4px;
        font-size: 12px;
        color: $gray-100;
      }

      li.item {
        text-overflow: ellipsis;
        line-height: 20px;
        margin: 0;
        padding: 2px 4px;

        &:hover,
        &:active,
        &.active {
          // color: white;
          background: $color-primary;
        }

        cursor: pointer;
      }
    }
  }

  & > section.colors {
    padding: 5px;
    overflow-y: scroll;
  }

  .color-grid {
    display: flex;
    flex-direction: row;

    .color-row {
      display: flex;
      flex-direction: column;
    }
  }

  .color-item {
    display: block;
    box-sizing: border-box;
    width: 26px;
    height: 26px;
    padding: 1px;
    cursor: pointer;

    &:hover,
    &.active {
      span {
        border: 1px solid black;
      }
    }

    span {
      display: inline-block;
      box-sizing: border-box;
      width: 24px;
      height: 24px;
      border: 1px solid white;
    }
  }

  &-null {
    border-top: 1px solid $gray-210;

    .charticulator__widget-control-button {
      width: 100% !important;
      &:not(:hover):not(:active) {
        background: none;
      }
    }
  }
}

.gradient-picker {
  overflow: hidden;
  width: 100%;
  max-width: 300px;
  font-size: 13px;
  display: flex;
  flex-direction: column;

  & > section.palettes {
    padding-top: 5px;
    overflow-y: scroll;
    overflow-x: hidden;
    max-height: 200px;
    border: 1px solid $gray-200;
    border-radius: 0 0 2px 2px;
    border-top: none;

    ul {
      list-style-type: none;
      margin: 0;
      padding: 0;

      .label {
        line-height: 20px;
        padding: 0px 4px;
        font-size: 12px;
        color: $gray-100;
      }

      li.item {
        display: flex;
        flex-direction: row;
        text-overflow: ellipsis;
        line-height: 20px;
        margin: 0;
        padding: 2px 4px;

        label {
          cursor: pointer;
          width: 80px;
          margin-left: 5px;
          text-overflow: ellipsis;
          overflow: hidden;
          flex-shrink: 0;
          display: inline-block;
        }

        &:hover,
        &:active,
        &.active {
          color: white;
          background: $color-primary;
        }

        .gradient-view {
          height: 20px;
          line-height: 20px;
          flex: 1;

          canvas {
            display: inline-block;
            width: 100%;
            height: 16px;
            line-height: 16px;
            border: 1px solid white;
            margin: 1px 0;
          }
        }

        cursor: pointer;
      }
    }
  }

  & > section.gradient-editor {
    overflow: hidden;
    display: flex;
    flex-direction: column;

    .row {
      margin: 5px 0px;
      flex-shrink: 0;
    }

    .gradient-view {
      display: block;
      height: 30px;
      line-height: 30px;
      flex: 1;

      canvas {
        display: inline-block;
        width: 100%;
        height: 28px;
        line-height: 28px;
        border: 1px solid white;
      }
    }

    .colors-scroll {
      padding: 4px;
      border: 1px solid $gray-200;
      border-radius: 2px;
      overflow-y: scroll;
      overflow-x: hidden;
      max-height: 250px;
    }

    .color-row {
      border-radius: 2px;

      &:hover {
        background: $gray-210;
      }
    }
    .controls-row {
      margin-top: 2px;
    }

    .color-item {
      display: inline-block;
      vertical-align: top;
      width: 20px;
      height: 20px;
      border: 1px solid $white;
      margin: 1px;
      margin-left: 0;
      cursor: pointer;
    }

    input {
      margin: 2px;
    }
  }

  input {
    width: 60px;

    @include font-mono;

    margin: 0;
    padding: 0;
    outline: none;
    border: none;
    background: none;
    font-size: 14px;
    height: 20px;
    padding-top: 1px;
    line-height: 20px;
    border-bottom: 1px solid $gray-180;

    &:hover,
    &:focus {
      border-bottom: 1px solid $color-primary;
    }

    box-sizing: border-box;
    transition: border-color $transition-default;
  }

  .part-buttons {
    text-align: right;
  }
}

.hcl-color-picker {
  display: flex;
  flex-direction: column;

  .row {
    margin-bottom: 5px;
  }

  .columns {
    display: flex;
    flex-direction: row;

    .column {
      margin-right: 10px;
    }
  }

  .part-picker {
    display: flex;
    flex-direction: row;

    .canvas-xy,
    .canvas-z {
      background: $gray-190;
      border-radius: 2px;
      margin-right: 5px;
      position: relative;

      canvas {
        background: $gray-230
          url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill-opacity=".1" ><rect x="50" width="50" height="50" /><rect y="50" width="50" height="50" /></svg>');
        background-size: 10px 10px;
        display: block;
        pointer-events: all;
        cursor: pointer;
      }

      svg {
        position: absolute;
        left: 0;
        top: 0;
        pointer-events: none;

        .bg {
          fill: none;
          stroke: rgba(0, 0, 0, 0.2);
          stroke-width: 3;
          pointer-events: none;
        }

        .fg {
          fill: none;
          stroke: white;
          pointer-events: none;
        }
      }
    }

    label {
      display: block;
      color: $gray-100;
      padding-top: 3px;
      margin-bottom: 2px;
    }

    .values {
      display: flex;
      flex-direction: column;

      .current-color {
        $size: 40px;

        display: inline-block;
        width: $size;
        height: $size;
        border: 1px solid white;

        span {
          display: inline-block;
          width: $size;
          height: $size;
        }
      }
    }
  }

  input {
    width: 60px;

    @include font-mono;

    margin: 0;
    padding: 0;
    outline: none;
    border: none;
    background: none;
    font-size: 14px;
    height: 20px;
    padding-top: 1px;
    line-height: 20px;
    border-bottom: 1px solid $gray-180;

    &:hover,
    &:focus {
      border-bottom: 1px solid $color-primary;
    }

    box-sizing: border-box;
    transition: border-color $transition-default;
  }

  .part-buttons {
    text-align: right;
  }
}

.gradient-view {
  display: inline-block;
  vertical-align: top;
  height: 20px;

  canvas {
    display: inline-block;
    vertical-align: top;
    width: 100px;
    height: 20px;
    border: 1px solid white;
    margin: 2px 0;
  }
}
